using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Text;
using System.Windows.Forms;
using BodySoundSimulator.AbsoluteMapData;
using BodySoundSimulator.CaseData;

namespace BodySoundSimulator.Recording
{
	public partial class BackViewSoundMapEffectsEditor : UserControl
	{
		#region Filelds
		ISoundMapEditorServices soundMapEditorServices;
		#endregion

		#region Constructors
		public BackViewSoundMapEffectsEditor(ISoundMapEditorServices soundMapEditorServices)
		{
			InitializeComponent();
			this.soundMapEditorServices = soundMapEditorServices;
			UpdateTrackBarTags();
			UpdateUI();
		}
		#endregion

		#region Private methods

		private void UpdateUI()
		{
			if (this.soundMapEditorServices.View == PatientView.BackView)
			{
				TrackBar[] trackBars = new TrackBar[] 
				{ 
					this.trkBarLungSoundOne, this.trkBarLungSoundTwo, this.trkBarLungSoundThree,
					this.trkBarLungSoundFour, this.trkBarLungSoundFive
				};
				foreach (TrackBar trackBar in trackBars)
				{
					trackBar.Value = (int)(this.soundMapEditorServices.SelectedBackViewCellContributionData.BackViewEffects[(int)((BackViewCommonAuscultationSiteType)trackBar.Tag)].Effect * 10);
				}
			}
		}

		private void UpdateTrackBarTags()
		{
			this.trkBarLungSoundOne.Tag = BackViewCommonAuscultationSiteType.lungSoundSiteOne;
			this.trkBarLungSoundTwo.Tag = BackViewCommonAuscultationSiteType.lungSoundSiteTwo;
			this.trkBarLungSoundThree.Tag = BackViewCommonAuscultationSiteType.lungSoundSiteThree;
			this.trkBarLungSoundFour.Tag = BackViewCommonAuscultationSiteType.lungSoundSiteFour;
			this.trkBarLungSoundFive.Tag = BackViewCommonAuscultationSiteType.lungSoundSiteFive;
		}
		#endregion
	}
}
